#include "Calculator.h"

Calculator::Calculator()
{

}

bool Calculator::construct()
{
    m_ui = CalculatorUI::NewInstance(); // 初始化用户界面类

    if ( m_ui!=NULL )
    {
        m_ui->setCalculator(&m_cal); // 设置业务逻辑实现类
    }

    return (m_ui!=NULL);
}


Calculator* Calculator::NewInstance()
{
    Calculator* ret = new Calculator();

    if ( ret==NULL || !ret->construct() )
    {
        delete ret;
        ret = NULL;
    }

    return ret;
}

void Calculator::show()
{
    m_ui->show();
}

Calculator::~Calculator()
{

}


